package com.mayikt.pay.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.mayikt.base.BaseApiService;
import com.mayikt.base.BaseResponse;
import com.mayikt.pay.mq.producer.Producer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Service
@RequestMapping("/rabbitmq")
public class RabbitMQServiceImpl extends BaseApiService {

    @Autowired
    private Producer producer;

    @PostMapping("/sendMsg")
    public BaseResponse sendMsg(){

        JSONObject jsonObject = new JSONObject();
        jsonObject.put("paymentId","123456");
        jsonObject.put("userId","1");
        jsonObject.put("integral",100);

        producer.send(jsonObject);

        return setResultSuccess();
    }
}
